﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="接箍质检数据录入.aspx.cs" Inherits="syc.Sale.接箍质检数据录" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:Label ID="BID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select t1.ID,t1.进度ID
,case when t1.车丝机 > 0 then cast(t1.车丝机 as varchar)+'#车废'
when t1.车丝机=-1 then '车丝' when t1.车丝机=-2 then '磁粉探伤' when t1.车丝机=-3 then '磁粉探伤废' else '其他' end as 类型
,t1.支数,t1.原因,t2.名称 as 供货单位,t1.炉号 from 接箍质检数据 t1
left outer join 原料供货单位 t2 on t1.供货=t2.ID where t1.进度ID=@BID order by t1.车丝机"

DeleteCommand="delete from 接箍质检数据 where ID=@ID;"
InsertCommand="insert into 接箍质检数据(进度ID,车丝机,支数,供货,炉号,原因)values(@BID,@车丝机,@支数,@供货,@炉号,@原因);"
onselected="SqlDataSource1_Selected" >
<InsertParameters>
<asp:ControlParameter Name="BID" DbType="Int32" Size="4" ControlID="BID" Direction="Input"/>
<asp:ControlParameter Name="车丝机" DbType="Int32" Size="4" ControlID="CheSiJi" Direction="Input"/>
<asp:ControlParameter Name="支数" DbType="Int32" Size="4" ControlID="ZhiShu" Direction="Input"/>
<asp:ControlParameter Name="供货" DbType="Int32" Size="4" ControlID="GongHuo" Direction="Input"/>
<asp:ControlParameter Name="炉号" DbType="String" Size="15" ControlID="LuHao" Direction="Input"/>
<asp:ControlParameter Name="原因" DbType="String" Size="30" ControlID="YuanYin" Direction="Input"/>
</InsertParameters>
<SelectParameters>
<asp:Parameter Name="BID" DbType="Int32" Size="4" DefaultValue="0" />
</SelectParameters>
</asp:SqlDataSource>
    
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID], [名称] FROM [原料供货单位]" ></asp:SqlDataSource>
    
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
SelectCommand="select @日期=日期,@产品=产品类别ID,@工段=工段
,@车丝=车丝1+车丝2+车丝3+车丝4+车丝5+车丝6+车丝7+车丝8+车丝9+车丝10
+车丝11+车丝12+车丝13+车丝14+车丝15+车丝16+车丝17+车丝18+车丝19+车丝20
,@车废=cast([车废1] as VARCHAR)+' '+cast([车废2] as VARCHAR)+' '+cast([车废3] as VARCHAR)+' '
+cast([车废4] as VARCHAR)+' '+cast([车废5] as VARCHAR)+' '+cast([车废6] as VARCHAR)+' '
+cast([车废7] as VARCHAR)+' '+cast([车废8] as VARCHAR)+' '+cast([车废9] as VARCHAR)+' '
+cast([车废10] as VARCHAR)+' '+cast([车废11] as VARCHAR)+' '+cast([车废12] as VARCHAR)+' '
+cast([车废13] as VARCHAR)+' '+cast([车废14] as VARCHAR)+' '+cast([车废15] as VARCHAR)+' '
+cast([车废16] as VARCHAR)+' '+cast([车废17] as VARCHAR)+' '+cast([车废18] as VARCHAR)+' '
+cast([车废19] as VARCHAR)+' '+cast([车废20] as VARCHAR)
,@磁粉碳伤合格=磁粉碳伤合格,@磁粉碳伤不合格=磁粉碳伤不合格
from 生产进度3 where ID=@BID;select top 1 @供货=供货,@炉号=炉号 from 接箍质检数据 order by id desc;" onselected="SqlDataSource3_Selected">
<SelectParameters>
<asp:Parameter Name="BID" DbType="Int32" Size="4" DefaultValue="0" Direction="Input" />
<asp:Parameter Name="日期" DbType="Date" Size="3" Direction="Output"/>
<asp:Parameter Name="产品" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="工段" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="车丝" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="车废" DbType="AnsiString" Size="200" Direction="Output"/>
<asp:Parameter Name="供货" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="炉号" DbType="AnsiString" Size="15" Direction="Output"/>
<asp:Parameter Name="磁粉碳伤合格" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="磁粉碳伤不合格" DbType="Int32" Size="4" Direction="Output"/>
</SelectParameters>
</asp:SqlDataSource>

    
<div id="wintop" class="wintop" style="display:none">接箍质检数据录入</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">

<asp:Button ID="Button_JinDu" runat="server" Text="进度数据" CssClass="button" UseSubmitBehavior="False" Enabled="false"/>
<input type="button" value="录入新进度" class="button" onclick="parent.swin2_load('/Fc/JinDu3_In.aspx',640,480);"/>
<input type="button" value="关 闭" class="button" onclick="parent.swin2_close();" />


</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel">
产品：<asp:DropDownList ID="ChanPin" runat="server" Width="120px" Enabled="false">
    <asp:ListItem Value="1">油管接箍(J55)</asp:ListItem>
    <asp:ListItem Value="2">套管接箍(J55)</asp:ListItem>
    <asp:ListItem Value="3">油管接箍(N80Q)</asp:ListItem>
    <asp:ListItem Value="4">套管接箍(N80Q)</asp:ListItem>
</asp:DropDownList> 
<span style="margin-left:10px;"></span>
班次：<asp:DropDownList ID="BanCi" runat="server" Width="100px" Enabled="false">
    <asp:ListItem Value="1">甲班</asp:ListItem>
    <asp:ListItem Value="2">乙班</asp:ListItem>
    <asp:ListItem Value="3">丙班</asp:ListItem>
    <asp:ListItem Value="4">丁班</asp:ListItem>
</asp:DropDownList>
<span style="margin-left:10px;"></span>
日期：<asp:Label ID="Date1" runat="server" Text=""></asp:Label>

<div style="font-size:4px;line-height:4px;height:4px;"></div>

类型：<asp:DropDownList ID="CheSiJi" runat="server" Width="120px" AutoPostBack="True" 
        onselectedindexchanged="CheSiJi_SelectedIndexChanged"></asp:DropDownList>
<span style="margin-left:10px;"></span>
支数：<asp:TextBox runat="server" ID="ZhiShu" CssClass="textbox" width="84"></asp:TextBox>支
<span style="margin-left:10px;"></span>
原因： 
  <asp:DropDownList ID="YuanYin" runat="server" Width="120px" Enabled="false">
  <asp:ListItem Value=""></asp:ListItem>
    <asp:ListItem Value="管体编号">管体编号</asp:ListItem>
    <asp:ListItem Value="锥度mm/m">维度mm/m</asp:ListItem>
    <asp:ListItem Value="螺距,10-3in">螺距,10-3in</asp:ListItem>
    <asp:ListItem Value="齿高,10-3in">齿高,10-3in</asp:ListItem>
    <asp:ListItem Value="紧密距,mm">紧密距,mm</asp:ListItem>
    <asp:ListItem Value="L4长度,mm">L4长度,mm</asp:ListItem>
    <asp:ListItem Value="Lc长度,mm">Lc长度,mm</asp:ListItem>
    <asp:ListItem Value="颤纹">颤纹</asp:ListItem>
</asp:DropDownList>  
<div style="font-size:4px;line-height:4px;height:4px;"></div>
供货：<asp:DropDownList ID="GongHuo" runat="server" Width="120" DataSourceID="SqlDataSource2" DataTextField="名称" DataValueField="ID"></asp:DropDownList>
<span style="margin-left:10px;"></span>
炉号：<asp:TextBox runat="server" ID="LuHao" CssClass="textbox" width="100"></asp:TextBox>
<span style="margin-left:30px;"></span>
<asp:Button ID="Button_Add" runat="server" Text="增 加" 
    CssClass="mbutton" UseSubmitBehavior="false" onclick="Button_Add_Click" />
</asp:Panel>

<style>
tr.tr.grid-row-normal{cursor:default;}
</style>
<div class="gridframe" style="padding:5px;">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">接箍质量数据</td>
	        </tr>
	        <tr>
	            <td class="grid-back" style="height:373px;">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
                        DataSourceID="SqlDataSource1" PageSize="15"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" >
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="类型">
                                <ItemTemplate>
                                    <asp:Label ID="Label_lx" runat="server" Text='<%# Eval("类型") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="支数">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zs" runat="server" Text='<%# Eval("支数") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="原因">
                                <ItemTemplate>
                                    <asp:Label ID="Label_yy" runat="server" Text='<%# Eval("原因") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="120px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="供货单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gh" runat="server" Text='<%# Eval("供货单位") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="120px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="炉号">
                                <ItemTemplate>
                                    <asp:Label ID="Label_lh" runat="server" Text='<%# Eval("炉号") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                            </asp:TemplateField>
                                                       
                            <asp:TemplateField HeaderText="操作" >
                                <ItemTemplate>
                                    <asp:Button ID="Button_Delete" runat="server" CommandName='Delete' Text="删 除" CssClass="mbutton" UseSubmitBehavior="false" OnClientClick="if(!confirm(msg))return(false);" />
                               </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            

                        </Columns>
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" UseSubmitBehavior="false" />
                                <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" UseSubmitBehavior="false" />
                                <input type="button" class="page-split" disabled />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" AutoPostBack="true"
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+"  UseSubmitBehavior="false"/>
                                <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" UseSubmitBehavior="false" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>
<script type="text/javascript">
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
</script>
<script type="text/javascript">
    setTimeout("document.getElementById('CheSiJi').focus();", 100);
var msg = '确认要删除该条记录吗？';
document.onkeydown = function(e) {
    if (!e) e = window.event;
    var tag = e.srcElement;
    if (!tag) tag = e.target;
    if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
        if (e.keyCode == 13) e.keyCode = 9;
    }
}
var textboxs = document.getElementsByTagName("input");
var i;
for (i = 0; i < textboxs.length; i++) {
    if (textboxs[i].className == "textbox") {
        //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
        textboxs[i].onfocus = function(e) { this.select(); };
    }
    else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
        textboxs[i].onfocus = function(e) { this.select(); };
    }
}
</script>
</body>
</html>
